<template>
  <div class="NewsList">
    <Header title="传智"> </Header>
    <ysHeader>
      <template #left>
        <span @click="$router.go(-1)">返回</span>
      </template>
    </ysHeader>
    <div class="box">
      <div
        class="list"
        v-for="value in newsList"
        :key="value.id"
        @click="$router.push({ path: `/NewsDetial/${value.id}` })"
      >
        <div class="left">
          <img :src="value.img_url" />
        </div>

        <div class="right">
          <h4>{{ value.title }}</h4>
          <div class="botton">
            <p>发表时间:{{ value.add_time.slice(0, 10) }}</p>
            <p>点击：{{ value.click }}</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>


<script>
import Header from "@/components/Header.vue";
import ysHeader from "@/components/ysHeader.vue";
import { GetNewsList } from "@/apis/post.js";
export default {
  components: {
    Header,
    ysHeader,
  },
  data() {
    return {
      newsList: [],
    };
  },
  mounted() {
    GetNewsList().then((res) => {
      // console.log(res);
      this.newsList = res.data.message;
      // console.log(res.data.message);
    });
  },
};
</script>


<style lang="less" scoped>
.NewsList {
  margin-bottom: 60px;
  .box {
    margin-top: 110px;

    .list {
      height: 85px;
      display: flex;
      padding: 15px 0 15px 10px;
      border-bottom: 1px solid #f0f0f1;

      .left {
        height: 55px;
        width: 55px;
        margin-right: 12px;
        img {
          height: 100%;
          width: 100%;
        }
      }
      .right {
        width: 100%;
        h4 {
          color: #969696;
          overflow: hidden;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
          display: -webkit-box;
        }
        .botton {
          padding-right: 20px;
          margin-top: 10px;
          display: flex;
          font-size: 14px;
          color: #26a2ff;
          justify-content: space-between;
        }
      }
    }
  }
  .Header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
  }
  .ysHeader {
    margin-top: 50px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
  }
}
</style>